#ifndef ILLCASE_H
#define ILLCASE_H
#include <QString>
#include <QMap>
#include <QVector>
#include <algorithm>
#include <QCoreApplication>
#include "xlsxdocument.h"
#include "xlsxchartsheet.h"
#include "xlsxcellrange.h"
#include "xlsxchart.h"
#include "xlsxrichstring.h"
#include "xlsxworkbook.h"
#include<QDebug>
using namespace QXlsx;
/*  date
    hospital,
    num,
    name,
    sex,
    health_insurance_type,
    ID,
    age,
    main_symptom,
    tone1,
    tone2,
    pulse,
    diagnosis,
    west_diagnosis,
    diagnosis_distinguish,
    med 饮片,
    triditional_med 中成药,
    western_med 西药,
    hspt_med 医院制剂,
    triditional_treatment 中医技术,
    other_treatment 其他疗法
    pacNum 帖数
    note 备注
*/

class illcase
{
public:
    illcase();
    illcase(QString a[],QString m[],int mednum,int numm);//传入字符串数组，按顺序储存（按照excel的顺序）
    QMap<QString,QString> a;
    QString &operator[] (QString s);
    int num;
    QString meds[50];
    int medsNum=0;
    void countMedsnum();
};

class illcases
{
public:
    QVector<illcase> a;
    QString userName;
    illcase recent10[10];
    int maxMedsNum=19;
    int cntr=0;
    illcases();
    illcases(QString name);//传入文件名
    illcase &operator[](int idx);
    void refreshR10();
    void delcase(int n);
    void addcase(QString p[],QString m[],int mednum,int numm);
    void addcase(QString p[],QString m[],int mednum);//传入字符串数组，按顺序储存（按照excel的顺序）
    int askpersonByName(QString name,illcase *l); //通过名字查询，传入一个空的illcase指针，函数结束l变成一个illcase对象的数组,存放每个重名病人的第一个病例，用于辨认。返回值为最后l数组的大小
    int askillcasesByID(QString ID,illcase *l); //通过ID查询，返回方式同上，返回的为目标ID的所有illcase
    void exportToExcel();
    QString items[30]={"date",
                       "hospital",
                       "num",
                       "name",
                       "sex",
                       "health_insurance_type",
                       "ID",
                       "age",
                       "main_symptom",
                       "tone1",
                       "tone2",
                       "pulse",
                       "diagnosis",
                       "west_diagnosis",
                       "diagnosis_distinguish",
                       "med",
                       "triditional_med",
                       "western_med",
                       "hspt_med",
                       "triditional_treatment",
                       "other_treatment",
                       "pacNum",
                       "note"};
};


#endif // ILLCASE_H
